﻿using Anley.DomainDrivenDesign.Contract.Helper;

namespace Anley.DomainDrivenDesign.Contract.Infrastructure;

/// <summary>
/// 缓存仓储类
/// </summary>
public abstract class CacheRepository
    : ICacheRepository
{
    protected CacheRepository()
    {
        DbContextProvider = ServiceProviderHelper.ServiceProvider
            .GetRequiredService<IRedisRepositoryContextProvider>();
    }

    // 仓储上下文提供程序
    public IRedisRepositoryContextProvider DbContextProvider { get; private set; }

    // 缓存提供程序
    public IRedisRepositoryContext DbContext => DbContextProvider.GetRepositoryContext();
}